<%@ page import="java.util.List" %>
<%@ page import="cn.kgc.javaweb.entity.User" %>
<%--
  Created by IntelliJ IDEA.
  User: mengshun
  Date: 2022/3/17
  Time: 14:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户信息展示页</title>
</head>
<body>

    <%--    获取用户信息展示   users--%>

    <%
            //在request作用域中获取参数
//        List<User> users =(List<User>) request.getAttribute("users");

          //在session对象中获取参数
          List<User> users =(List<User>)  session.getAttribute("users");
    %>
<%--    展示数据--%>
    <table border="1px" cellspacing="0" width="100%" height="200px">
        <tr>
            <th>ID</th>
            <th>名字</th>
            <th>密码</th>
            <th>角色</th>
        </tr>
       <%-- java  遍历集合  --%>
        <%
            for (User user : users) {
          %>
                <tr>
                    <td><%=user.getId()%></td>
                    <td><%=user.getUsername()%></td>
                    <td><%=user.getPwd()%></td>
                    <td><%=user.getRole()%></td>
                </tr>
        <%
            }
        %>




    </table>




</body>
</html>
